/**
 * Created with IntelliJ IDEA.
 * Description: 练习
 * User: cjc
 * Date: 2025-02-27
 * Time: 19:33
 */
public class Test {
    //编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static void calc(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            int a = i / 10;
            int b = i % 10;
            if(a == 9) {
                count++;
            }
            if(b == 9) {
                count++;
            }
        }
        System.out.println("count == "+count);
    }

    //输出 1000 ~ 2000 之间所有的闰年
    public static void Year(String[] args) {
        int year = 1000;
        for(;year <= 2000;year++) {
            if((year%4==0&&year%100!=0)||year%400==0) {
                System.out.print(year + " ");
            }
        }
    }

    //打印 1 ~ 100 之间所有的素数
    public static void IsPrime(String[] args) {
        for(int i = 2; i <=100 ; i++) {
            boolean flag = true;
            for(int j = 2;j <= Math.sqrt(i);j++) {
                if(i%j == 0) {
                    flag = false;
                    break;
                }
            }
            if(flag) {
                System.out.print(i + " ");
            }
        }
    }
}
